//
//  TestBInterceptor.swift
//  XNavigator_Example
//
//  Created by x on 2024/9/1.
//  Copyright © 2024 CocoaPods. All rights reserved.
//

import XNavigator

class BInterceptor: RouteInterceptor {

    var order: Int { return 0}
    
    func intercept(route: UnionType, completion: @escaping (Bool) -> Void) {
        print("BInterceptor Intercepting route \(route)")
        
//        拦截B VC
        switch route {
        case .appRoute(let r):
            if let defaultRoute = r as? DefaultRoute {
                switch defaultRoute {
                case .Boute:
                    completion(false)
                default:
                    completion(true)
                }
            }
        case .url(_):
            completion(true)
        }
        
    }
    
    func willNavigate(to route: UnionType) {
        print("BInterceptor willNavigate \(route)")
    }
    
    func didNavigate(to route: UnionType) {
        print("BInterceptor didNavigate \(route)")
    }
}
